package com.webchat.rmi.pgc.sys;


import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.sys.SysDataDictionaryDetailRequestVo;
import com.webchat.domain.vo.request.sys.SysDataDictionaryRequestVO;
import com.webchat.domain.vo.response.sys.SysDataDictionaryDetailBaseVO;
import com.webchat.domain.vo.response.sys.SysDataDictionaryResponseVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 数据字典 远程调用接口
 *
 * @author SongRenShuo
 * @date 2025/06/25
 */
@FeignClient(name = "webchat-pgc-service",
        contextId = "sysDataDictionaryClient",
        configuration = RpcRequestInterceptor.class)
public interface SysDataDictionaryClient {

    /**
     * 获取数据字典详情列表
     *
     * @param code 数据字典编号
     * @return {@link APIResponseBean }<{@link Map }<{@link String },{@link String }>>
     */
    @GetMapping("/pgc-service/sys/data-dictionary/detail/{code}")
    APIResponseBean<Map<String,String>> detail(@PathVariable String code);



    /**
     * 创建或者更新数据字典
     *
     * @param requestVO 请求 VO
     * @return {@link APIResponseBean }<{@link Long }>
     */
    @PostMapping("/pgc-service/sys/data-dictionary/save")
    APIResponseBean<Long> save(@RequestBody SysDataDictionaryRequestVO requestVO);

    /**
     * 删除数据
     *
     * @param dictionaryId 主键
     * @param userId     用户 ID
     * @return {@link APIResponseBean }<{@link Boolean }>
     */
    @PostMapping("/pgc-service/sys/data-dictionary/delete/{dictionaryId}/{userId}")
    APIResponseBean<Boolean> delete(@PathVariable Long dictionaryId, @PathVariable String userId);

    /**
     * 分页查询数据字典
     *
     * @param categoryId     分类 ID
     * @param code     编号
     * @param name     名称
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @return {@link APIPageResponseBean }<{@link SysDataDictionaryResponseVO }>
     */
    @GetMapping("/pgc-service/sys/data-dictionary/page")
    APIPageResponseBean<SysDataDictionaryResponseVO> page(@RequestParam(value = "categoryId", required = false) Long categoryId,
                                                          @RequestParam(value = "code", required = false) String code,
                                                          @RequestParam(value = "name", required = false) String name,
                                                          @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                          @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);






    /**
     * 创建或者更新数据字典详情
     *
     * @param requestVO 请求 VO
     * @return {@link APIResponseBean }<{@link Long }>
     */
    @PostMapping("/pgc-service/sys/data-dictionary/saveDetail")
    APIResponseBean<Long> saveDetail(@RequestBody SysDataDictionaryDetailRequestVo requestVO);

    /**
     * 删除数据字典详情
     *
     * @param detailId 主键
     * @param userId     用户 ID
     * @return {@link APIResponseBean }<{@link Boolean }>
     */
    @PostMapping("/pgc-service/sys/data-dictionary/deleteDetail/{detailId}/{userId}")
    APIResponseBean<Boolean> deleteDetail(@PathVariable Long detailId, @PathVariable String userId);

    /**
     * 分页查询数据字典详情
     *
     * @param dataDictionaryId     数据字典ID
     * @param code     编号
     * @param name     名称
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @return {@link APIPageResponseBean }<{@link SysDataDictionaryDetailBaseVO }>
     */
    @GetMapping("/pgc-service/sys/data-dictionary/pageDetail")
    APIPageResponseBean<SysDataDictionaryDetailBaseVO> pageDetail(@RequestParam(value = "dataDictionaryId") Long dataDictionaryId,
                                                                  @RequestParam(value = "code", required = false) String code,
                                                                  @RequestParam(value = "name", required = false) String name,
                                                                  @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                                  @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);





}
